/*
 *
 *      Copyright (c) 2018-2025, cloud All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the pig4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: cloud
 *
 */

package com.fuyao.cloud.message.feign;

import com.fuyao.cloud.common.core.constant.SecurityConstants;
import com.fuyao.cloud.common.core.constant.ServiceNameConstants;
import com.fuyao.cloud.common.core.util.R;
import com.fuyao.cloud.message.dto.ManagementUserObjectSearchDTO;
import com.fuyao.cloud.message.entity.ShoreMessageRecord;
import com.fuyao.cloud.message.entity.SystemMessageRecord;
import com.fuyao.cloud.message.vo.ManagementUserObjectVO;
import com.fuyao.cloud.message.vo.MessageRuleVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/**
 * @author cloud
 * @date 2020/12/05
 */
@FeignClient(contextId = "remoteMessageService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteMessageService {

    /**
     * 查询发送记录
     *
     * @param searchDTO 查询参数对象
     * @param from      是否内部调用
     * @return R
     */
    @PostMapping("/messagemanagement/listManagementUserObjectMode")
    R<List<ManagementUserObjectVO>> listManagementUserObjectMode(@RequestBody ManagementUserObjectSearchDTO searchDTO, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 保存短信发送记录
     *
     * @param recordList 短信集合
     * @param from       是否为内部调用标识
     * @return 是否保存成功。
     */
    @PostMapping("/shoremessagerecord/saveList")
    R<Boolean> saveShoreMessageList(@RequestBody List<ShoreMessageRecord> recordList, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 保存系统消息发送记录
     *
     * @param recordList 系统消息集合
     * @param from       是否为内部调用标识
     * @return 是否保存成功。
     */
    @PostMapping("/systemmessagerecord/saveList")
    R<Boolean> saveSystemMessageList(@RequestBody List<SystemMessageRecord> recordList, @RequestHeader(SecurityConstants.FROM) String from);


    /**
     * 查询所有规则
     * @return R
     */
    @PostMapping("/messagemanagement/listMessageRules/{id}")
    R<List<MessageRuleVO>> listMessageRules(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM) String from);


    @PostMapping("/messagemanagement/listManagement")
    R<List<ManagementUserObjectVO>> listManagement(@RequestBody ManagementUserObjectSearchDTO searchDTO, @RequestHeader(SecurityConstants.FROM) String from);

}
